home *** CD-ROM | disk | FTP | other *** search
- #
- # convlib.test
- #
- # Tests for tcl.tlib convert_lib routine.
- #---------------------------------------------------------------------------
- # Copyright 1992 Karl Lehenbauer and Mark Diekhans.
- #
- # Permission to use, copy, modify, and distribute this software and its
- # documentation for any purpose and without fee is hereby granted, provided
- # that the above copyright notice appear in all copies. Karl Lehenbauer and
- # Mark Diekhans make no representations about the suitability of this
- # software for any purpose. It is provided "as is" without express or
- # implied warranty.
- #------------------------------------------------------------------------------
- # $Id: convlib.test,v 2.0 1992/10/16 04:49:34 markd Rel $
- #------------------------------------------------------------------------------
- #
-
- if {[info procs test] == ""} then {source testlib.tcl}
- rename SAVED_UNKNOWN unknown
-
- # Create a temporary tclIndex file and the files it points to.
-
- set fh [open tclIndex w]
- loop num 0 5 {
- puts $fh "LoadProc${num}A tmp${num}.tcl"
- puts $fh "LoadProc${num}B tmp${num}.tcl"
- }
- puts $fh "foo init.tcl" ;# Should not be used.
- close $fh
-
- loop num 0 5 {
- set fh [open tmp${num}.tcl w]
- puts $fh "proc LoadProc${num}A {} {return @LoadProc${num}A@}"
- puts $fh "proc LoadProc${num}B {} {return @LoadProc${num}B@}"
- close $fh
- }
-
- # Proc that validates the library by executing procs out of it.
-
- proc LibValidate {testid testname} {
- loop num 0 5 {
- test $testid $testname {
- LoadProc${num}A
- } "@LoadProc${num}A@"
- test $testid $testname {
- LoadProc${num}B
- } "@LoadProc${num}B@"
- }
- }
-
- #
- # Now convert and load the library, see if we can actually use it.
- #
-
- test convlib-1.1 {Convert library tests} {
- unlink -nocomplain {tmp.tlib tmp.tndx}
- convert_lib [pwd]/tclIndex tmp "init.tcl"
- list [file exists tmp.tlib] [file exists tmp.tndx]
- } {1 1}
-
- test convlib-1.2 {Convert library tests} {
- unlink -nocomplain {tmp.tlib tmp.tndx}
- convert_lib [pwd]/tclIndex tmp.tlib "init.tcl"
- loadlibindex tmp.tlib
- list [file exists tmp.tlib] [file exists tmp.tndx]
- } {1 1}
-
- LibValidate convlib-1.3 {Convert library tests}
-
- unlink -nocomplain {tmp0.tcl tmp1.tcl tmp2.tcl tmp3.tcl tmp4.tcl
- tmp.tlib tmp.tndx tclIndex}
- rename unknown SAVED_UNKNOWN
-